package com.shop2cn.iapi.promotion.testcase;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.promotion.parameter.PlaceOrderCalculateReq;
import com.shop2cn.iapi.promotion.parameter.PlaceOrderCalculateResp;
import com.shop2cn.iapi.promotion.parameter.ProductDto;
import com.shop2cn.iapi.promotion.parameter.ProductPromotionInfoDto;
import com.shop2cn.iapi.promotion.parameter.SellerProductDto;
import com.shop2cn.iapi.promotion.serivce.CalcOrderPromotionInfoCall;
import com.shop2cn.iapi.promotion.serivce.PromotionInfoVerify;
import com.shop2cn.iapi.sellerpromotion.parameter.CreatePromotionBean;
import com.shop2cn.iapi.sellerpromotion.parameter.PromotionItem;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.Shop2cnSellerPromotionCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
/**
*计算订单优惠信息
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_CalcOrderPromotionInfo{
	private static PlaceOrderCalculateReq calcorderpromotioninfoBean;
	private static CalcOrderPromotionInfoCall calcorderpromotioninfoCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("计算订单优惠信息");
	}

	@Before
	public void caseUp() {
		calcorderpromotioninfoBean=new PlaceOrderCalculateReq();
		calcorderpromotioninfoCall=new CalcOrderPromotionInfoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(calcorderpromotioninfoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	public PlaceOrderCalculateReq initPlaceOrderCalculateReq(Integer mchId,List<ProductDto> pdtos) {
		PlaceOrderCalculateReq PlaceOrderCalculateReq=new PlaceOrderCalculateReq();
		PlaceOrderCalculateReq.setBuyerId(111);
		List<SellerProductDto> sellerProductDtos=new ArrayList<SellerProductDto>();
		SellerProductDto sellerProductDto=new SellerProductDto();
		sellerProductDto.setSellerId(mchId);
		List<ProductDto> productDtos=new ArrayList<ProductDto>();
		pdtos.forEach(p->{
			ProductDto productDto=new ProductDto();
			productDto.setProductId(p.getProductId());
			productDto.setCatalogId(p.getCatalogId());
			productDto.setCurrency(p.getCurrency());
			productDto.setProductQty(p.getProductQty());
			productDto.setProductUnitPrice(p.getProductUnitPrice());
		//	productDto.setfreeFreight(true);//免包邮 新增 summing 20191231 
			productDtos.add(productDto);
		});
		sellerProductDto.setProductDtos(productDtos);
		sellerProductDtos.add(sellerProductDto);
		PlaceOrderCalculateReq.setSellerProductDtos(sellerProductDtos);
		return PlaceOrderCalculateReq;
	}
	private void verifyProductPromotionInfoDto(List<ProductDto> returnpdtos, List<ProductDto> sendpdtos) {
		returnpdtos.forEach(rp->{
			ProductDto sendpdto = sendpdtos.stream().filter(s->{return s.getProductId().equals(rp.getProductId());}).findFirst().get();
			Logger.verifyEquals(sendpdto.getProductId(), rp.getProductId(), "验证返回ProductId");
			Logger.verifyEquals(sendpdto.getCatalogId(), rp.getCatalogId(), "验证返回CatalogId");
			Logger.verifyEquals(sendpdto.getProductUnitPrice(), rp.getProductUnitPrice(), "验证返回ProductUnitPrice");
			Logger.verifyEquals(sendpdto.getProductQty(), rp.getProductQty(), "验证返回ProductQty");
			Logger.verifyEquals(sendpdto.getProductUnitPrice().multiply(new BigDecimal(sendpdto.getProductQty())), rp.getProductTotalPrice(), "验证返回ProductTotalPrice");
			
			
			//Logger.verifyEquals(sendpdto.getProd uctQty(), rp.getfreeFreight(), "验证返回freeFreight");
		});
		
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_001() {
		Logger.start(true,"计算订单优惠信息-全场满件减1,满2件减1");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			Thread.sleep(10000);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	

	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_002() {
		Logger.start(true,"计算订单优惠信息-全场满件折2,满2件9折");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			//满两件9折 100一件总价200 优惠20
			Logger.verifyEquals(BigDecimal.valueOf(20).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_003() {
		Logger.start(true,"计算订单优惠信息-全场满额减3,满100件减10");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 3,Arrays.asList(new PromotionItem(1, 100, 10d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(10).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_004() {
		Logger.start(true,"计算订单优惠信息-全场满额折4,满100件9折");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 4,Arrays.asList(new PromotionItem(1, 100, 9d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			//满两件9折 100一件总价200 优惠20
			Logger.verifyEquals(BigDecimal.valueOf(10).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_005() {
		Logger.start(true,"计算订单优惠信息-指定商品满件减1,满2件减1");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d,2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_006() {
		Logger.start(true,"计算订单优惠信息-指定商品满件折2,满2件9折");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			//满两件9折 100一件总价200 优惠20
			Logger.verifyEquals(BigDecimal.valueOf(20).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_007() {
		Logger.start(true,"计算订单优惠信息-指定商品满额减3,满100元减10");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 3,Arrays.asList(new PromotionItem(1, 100, 10d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(10).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_008() {
		Logger.start(true,"计算订单优惠信息-指定商品满额折4,满100元9折");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 4,Arrays.asList(new PromotionItem(1, 100, 9d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			//满两件9折 100一件总价200 优惠20
			Logger.verifyEquals(BigDecimal.valueOf(10).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_009() {
		Logger.start(true,"计算订单优惠信息-全场满件减1,多级满2件减1,满5件减2");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d),new PromotionItem(2, 5, 2d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 5, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(2).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
			//bug 满2应该拿第一级优惠10 现在拿成了第二级优惠20
			pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_010() {
		Logger.start(true,"计算订单优惠信息-全场满件折2,多级满2件9折,满5件8折");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d),new PromotionItem(1, 5, 8d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 5, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			//满5件8折 100一件总价500 优惠100
			Logger.verifyEquals(BigDecimal.valueOf(100).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
			
			pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(20).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_011() {
		Logger.start(true,"计算订单优惠信息-全场满额减3,多级满100元10,满200元减20");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 3,Arrays.asList(new PromotionItem(1, 100, 10d),new PromotionItem(2, 200, 20d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(20).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");	
			
			
			pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(10).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_012() {
		Logger.start(true,"计算订单优惠信息-全场满额折4,多级满100元9折,满200元8折");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 4,Arrays.asList(new PromotionItem(1, 100, 9d),new PromotionItem(1, 200, 8d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(40).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
	
			pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(10).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_013() {
		Logger.start(true,"计算订单优惠信息-指定商品满件减1,多级满2件减1,满5件减2");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d),new PromotionItem(2, 5, 2d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 5, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(2).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_014() {
		Logger.start(true,"计算订单优惠信息-指定商品满件折2,多级满2件9折,满5件8折");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d),new PromotionItem(1, 5, 8d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 5, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			//满5件8折 100一件总价500 优惠100
			Logger.verifyEquals(BigDecimal.valueOf(100).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_015() {
		Logger.start(true,"计算订单优惠信息-指定商品满额减3,多级满100元减10,满200元减20");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 3,Arrays.asList(new PromotionItem(1, 100, 10d),new PromotionItem(2, 200, 20d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(20).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_016() {
		Logger.start(true,"计算订单优惠信息-指定商品满额折4,多级满100元9折,满200元8折");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 4,Arrays.asList(new PromotionItem(1, 100, 9d),new PromotionItem(1, 200, 8d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(40).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_017() {
		Logger.start(true,"计算订单优惠信息-外币JPY全场满件减1,满2件减1");
		try {
			Integer mchId = GodmchManageCallService.CreateCountrySellerMch("JPN");
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			createpromotionBean.setCurrency("JPY");
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "JPY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_018() {
		Logger.start(true,"计算订单优惠信息-外币JPY全场满件折2,满2件9折");
		try {
			Integer mchId = GodmchManageCallService.CreateCountrySellerMch("JPN");
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			createpromotionBean.setCurrency("JPY");
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "JPY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(20).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_019() {
		Logger.start(true,"计算订单优惠信息-外币JPY全场满件折2,满2件9折-结果带小数时截断");
		try {
			Integer mchId = GodmchManageCallService.CreateCountrySellerMch("JPN");
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			createpromotionBean.setCurrency("JPY");
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 13d, 3, "JPY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(3).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_020() {
		Logger.start(true,"计算订单优惠信息-全场满件减1,满2件减1-活动未开始不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			createpromotionBean.setBegin(YMTDateUtil.getBeforeOrNextDay(1,"yyyy-MM-dd HH:mm:ss"));
			createpromotionBean.setEnd(YMTDateUtil.getBeforeOrNextDay(2,"yyyy-MM-dd HH:mm:ss"));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_021() {
		Logger.start(true,"计算订单优惠信息-全场满件折2,满2件9折-活动未开始不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			createpromotionBean.setBegin(YMTDateUtil.getBeforeOrNextDay(1,"yyyy-MM-dd HH:mm:ss"));
			createpromotionBean.setEnd(YMTDateUtil.getBeforeOrNextDay(2,"yyyy-MM-dd HH:mm:ss"));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_022() {
		Logger.start(true,"计算订单优惠信息-全场满额减3,满100件减10-活动未开始不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId,3,Arrays.asList(new PromotionItem(1, 100, 10d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			createpromotionBean.setBegin(YMTDateUtil.getBeforeOrNextDay(1,"yyyy-MM-dd HH:mm:ss"));
			createpromotionBean.setEnd(YMTDateUtil.getBeforeOrNextDay(2,"yyyy-MM-dd HH:mm:ss"));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_023() {
		Logger.start(true,"计算订单优惠信息-全场满额折4,满100元9折-活动未开始不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId,4,Arrays.asList(new PromotionItem(1, 100, 9d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			createpromotionBean.setBegin(YMTDateUtil.getBeforeOrNextDay(1,"yyyy-MM-dd HH:mm:ss"));
			createpromotionBean.setEnd(YMTDateUtil.getBeforeOrNextDay(2,"yyyy-MM-dd HH:mm:ss"));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_024() {
		Logger.start(true,"计算订单优惠信息-全场满件减1,满2件减1-活动已结束不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			Shop2cnSellerPromotionCallService.EndAllEnablePromotion(mchId);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_025() {
		Logger.start(true,"计算订单优惠信息-全场满件折2,满2件9折-活动已结束不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			Shop2cnSellerPromotionCallService.EndAllEnablePromotion(mchId);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_026() {
		Logger.start(true,"计算订单优惠信息-全场满额减3,满100件减10-活动已结束不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 3,Arrays.asList(new PromotionItem(1, 100, 10d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			Shop2cnSellerPromotionCallService.EndAllEnablePromotion(mchId);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_027() {
		Logger.start(true,"计算订单优惠信息-全场满额折4,满100件9折-活动已结束不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 4,Arrays.asList(new PromotionItem(1, 100, 9d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			Shop2cnSellerPromotionCallService.EndAllEnablePromotion(mchId);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_028() {
		Logger.start(true,"计算订单优惠信息-指定商品满件减1,满2件减1-商品不是活动中商品不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_029() {
		Logger.start(true,"计算订单优惠信息-指定商品满件减2,满2件9折-商品有活动中也有活动外商品,总数不达标不计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"),new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_030() {
		Logger.start(true,"计算订单优惠信息-指定商品满件减1,满2件减1-商品有活动中也有活动外商品,总数达标计算");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d,2, "CNY"),new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 100d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			Logger.verifyEquals(pid, productPromotionInfoDto.getProductDtos().get(0).getProductId(), "验证商品是有效的");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_031() {
		Logger.start(true,"计算订单优惠信息-指定商品满额减3,满100元减10-多个指定商品活动且sameProductUse为false,商品总金额超出计算(p1=60元p2=40元均参加活动)");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 3,Arrays.asList(new PromotionItem(1, 100, 10d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid,pid2));
			createpromotionBean.setSameProductUse(false);
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 60d, 1, "CNY"),new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 40d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(10).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_032() {
		Logger.start(true,"计算订单优惠信息-指定商品满额折4,满100元9折-多个指定商品活动且sameProductUse为true,商品总金额超出单个商品不超不计算(p1=60元p2=40元均参加活动不优惠-仅支持同商品满减)");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 4,Arrays.asList(new PromotionItem(1, 100, 9d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid,pid2));
			createpromotionBean.setSameProductUse(true);
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 60d, 1, "CNY"),new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 40d, 1, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(0, sellerProductsPromotionInfos.getSellerPromotionDtos().size(), "验证返回null");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_033() {
		Logger.start(true,"计算订单优惠信息-混合场景-订单中有4个商品对应4个优惠场景均达标-计算优惠");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			String pid3 =TestDataManager.getRandomUUID().toString();
			String pid4 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId1 = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			CreatePromotionBean createpromotionBean2 = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 2, 9d)));
			createpromotionBean2.setProductIdList(Arrays.asList(pid2));
			Integer promotionId2 = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean2);
			
			CreatePromotionBean createpromotionBean3 = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 3,Arrays.asList(new PromotionItem(1, 100, 10d)));
			createpromotionBean3.setProductIdList(Arrays.asList(pid3));
			Integer promotionId3 = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean3);
			
			CreatePromotionBean createpromotionBean4 = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 4,Arrays.asList(new PromotionItem(1, 100, 9d)));
			createpromotionBean4.setProductIdList(Arrays.asList(pid4));
			Integer promotionId4 = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean4);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"),new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"),new ProductDto(pid3, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"),new ProductDto(pid4, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			List<ProductPromotionInfoDto> productPromotionInfoDtos = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos();
			//预算每个活动的实际减额
			Map<Integer,BigDecimal> m=new HashMap<Integer,BigDecimal>();
			m.put(promotionId1, BigDecimal.valueOf(1));
			m.put(promotionId2, BigDecimal.valueOf(20));
			m.put(promotionId3, BigDecimal.valueOf(10));
			m.put(promotionId4, BigDecimal.valueOf(20));
			productPromotionInfoDtos.forEach(productPromotionInfoDto->{
				PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
				try {
					promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
				} catch (Exception e) {
					e.printStackTrace();
				}
				verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
				BigDecimal value = m.get(productPromotionInfoDto.getPromotionPolicyDto().getPromotionId());
				Logger.verifyEquals(value.setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			});
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_034() {
		Logger.start(true,"计算订单优惠信息-全场满件减1,满2件减1.5-小数点支持");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1.5d)));
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1.5).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore
	public void Tc_CalcOrderPromotionInfo_035() {
		Logger.start(true,"计算订单优惠信息-外币KRW全场满件折2,满1件9折-SameProductUse为true-结果带小数时截断");
		try {
			Integer mchId = GodmchManageCallService.CreateCountrySellerMch("KOR");
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 1, 9d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid,pid2));
//			createpromotionBean.setSameProductUse(false);
			createpromotionBean.setCurrency("KRW");
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 29d, 1, "KRW"),new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 19d, 1, "KRW"));
			Map<String,BigDecimal > m=new HashMap<String,BigDecimal>();
			m.put(pid, BigDecimal.valueOf(2));
			m.put(pid2, BigDecimal.valueOf(1));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().forEach(productPromotionInfoDto->{
				PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
				try {
					promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
				} catch (Exception e) {
					e.printStackTrace();
				}
				verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
				BigDecimal v = m.get(productPromotionInfoDto.getProductDtos().get(0).getProductId());
				Logger.verifyEquals(v.setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore
	public void Tc_CalcOrderPromotionInfo_036() {
		Logger.start(true,"计算订单优惠信息-外币KRW全场满件减1,满1件减5-SameProductUse为true-结果带小数时截断");
		try {
			Integer mchId = GodmchManageCallService.CreateCountrySellerMch("KOR");
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 1, 5d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid,pid2));
			createpromotionBean.setSameProductUse(true);
			createpromotionBean.setCurrency("KRW");
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 29d, 1, "KRW"),new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 19d, 1, "KRW"));
			Map<String,BigDecimal > m=new HashMap<String,BigDecimal>();
			m.put(pid, BigDecimal.valueOf(5));
			m.put(pid2, BigDecimal.valueOf(5));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().forEach(productPromotionInfoDto->{
				PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
				try {
					promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
				} catch (Exception e) {
					e.printStackTrace();
				}
				verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
				BigDecimal v = m.get(productPromotionInfoDto.getProductDtos().get(0).getProductId());
				Logger.verifyEquals(v.setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore
	public void Tc_CalcOrderPromotionInfo_037() {
		Logger.start(true,"计算订单优惠信息-外币KRW全场满件折2,满1件9折-SameProductUse为false-结果带小数时截断");
		try {
			Integer mchId = GodmchManageCallService.CreateCountrySellerMch("KOR");
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			String pid3 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 2,Arrays.asList(new PromotionItem(1, 1, 9d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid,pid2,pid3));
			createpromotionBean.setSameProductUse(false);
			createpromotionBean.setCurrency("KRW");
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 29d, 1, "KRW"),new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 29d, 1, "KRW"),new ProductDto(pid3, TestDataManager.getRandomUUID().toString(), 19d, 1, "KRW"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
				try {
					promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
				} catch (Exception e) {
					e.printStackTrace();
				}
				verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
				//29+29+19=77->7 差额累计在最后一个商品
				Logger.verifyEquals(BigDecimal.valueOf(7).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore
	public void Tc_CalcOrderPromotionInfo_038() {
		Logger.start(true,"计算订单优惠信息-外币KRW全场满件减1,满1件减5-SameProductUse为false-结果带小数时截断");
		try {
			Integer mchId = GodmchManageCallService.CreateCountrySellerMch("KOR");
			String pid =TestDataManager.getRandomUUID().toString();
			String pid2 =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 1, 5d)));
			createpromotionBean.setProductIdList(Arrays.asList(pid,pid2));
			createpromotionBean.setSameProductUse(false);
			createpromotionBean.setCurrency("KRW");
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 29d, 1, "KRW"),new ProductDto(pid2, TestDataManager.getRandomUUID().toString(), 19d, 1, "KRW"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
				try {
					promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
				} catch (Exception e) {
					e.printStackTrace();
				}
				verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
				Logger.verifyEquals(BigDecimal.valueOf(5).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_039() {
		Logger.start(true,"计算订单优惠信息-全场满件减1,满2件减1-免包邮");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
			createpromotionBean.getPromotionItemList().get(0).setfreeFreight(true);//免包邮
			
//			createpromotionBean.setProductIdList(Arrays.asList(pid));
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			Thread.sleep(10000);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),true);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
			//验证 ProductInfos 中freeFreight 新增2020-01-02 summing
			ProductDto productDto=productPromotionInfoDto.getProductDtos().get(0);
			Logger.comment("productDto.getfreeFreight():"+productDto.getfreeFreight());
			if(productDto!=null)
				 Logger.verifyEquals(true,productDto.getfreeFreight(), "验证ProductInfos中的FreeFreight");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_040() {
		Logger.start(true,"计算订单优惠信息-全场满件减1,满2件减1-免包邮-上海地区包邮-与计算传入地址一致");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
			
			List<String> freeRegions=new ArrayList<>();
			freeRegions.add("上海");
			createpromotionBean.getPromotionItemList().get(0).setFreeRegions(freeRegions);//上海包邮
			createpromotionBean.getPromotionItemList().get(0).setfreeFreight(true);//免包邮
		
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			Thread.sleep(10000);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			
			calcorderpromotioninfoBean.setProvince("上海");
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false,productPromotionInfoDto.getProductDtos().get(0));
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
			//验证 ProductInfos 中freeFreight 新增2020-01-02 summing
			ProductDto productDto=productPromotionInfoDto.getProductDtos().get(0);
			Logger.comment("productDto.getfreeFreight():"+productDto.getfreeFreight());
			if(productDto!=null)
				 Logger.verifyEquals(true,productDto.getfreeFreight(), "验证ProductInfos中的FreeFreight");

			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_040_1() {
		Logger.start(true,"计算订单优惠信息-全场满件减1,满2件减1-免包邮-上海地区包邮-与计算传入地址不一致(北京)");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
			
			List<String> freeRegions=new ArrayList<>();
			freeRegions.add("上海");
			createpromotionBean.getPromotionItemList().get(0).setFreeRegions(freeRegions);//上海包邮
			createpromotionBean.getPromotionItemList().get(0).setfreeFreight(true);//免包邮
		
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			Thread.sleep(5000);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			
			calcorderpromotioninfoBean.setProvince("北京");
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false,productPromotionInfoDto.getProductDtos().get(0));
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			//验证 ProductInfos 中freeFreight 新增2020-01-02 summing
			ProductDto productDto=productPromotionInfoDto.getProductDtos().get(0);
			Logger.comment("productDto.getfreeFreight():"+productDto.getfreeFreight());
			if(productDto!=null)
				 Logger.verifyEquals(false,productDto.getfreeFreight(), "验证ProductInfos中的FreeFreight");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CalcOrderPromotionInfo_041() {
		Logger.start(true,"计算订单优惠信息-全场满件减1,满2件减1-不免包邮");
		try {
			Integer mchId = GodmchManageCallService.CreateSellerMch();
			String pid =TestDataManager.getRandomUUID().toString();
			CreatePromotionBean createpromotionBean = Shop2cnSellerPromotionCallService.initCreatePromotionBean(mchId, 1,Arrays.asList(new PromotionItem(1, 2, 1d)));
			//不包邮
			createpromotionBean.getPromotionItemList().get(0).setfreeFreight(false);//不免包邮
			
			Integer promotionId = Shop2cnSellerPromotionCallService.CreatepromotionCall(createpromotionBean);
			Thread.sleep(10000);
			List<ProductDto> pdtos=Arrays.asList(new ProductDto(pid, TestDataManager.getRandomUUID().toString(), 100d, 2, "CNY"));
			calcorderpromotioninfoBean=initPlaceOrderCalculateReq(mchId, pdtos);
			
			calcorderpromotioninfoCall.setData(calcorderpromotioninfoBean);
			calcorderpromotioninfoCall.callService();
			Logger.verifyEquals("200", calcorderpromotioninfoCall.getCode(), "验证返回Code");
			PlaceOrderCalculateResp sellerProductsPromotionInfos = calcorderpromotioninfoCall.getData();
			Logger.verifyEquals(mchId, sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getSellerId(), "验证返回SellerId");

			ProductPromotionInfoDto productPromotionInfoDto = sellerProductsPromotionInfos.getSellerPromotionDtos().get(0).getProductPromotionInfoDtos().get(0);
			PromotionInfoVerify promotionInfoVerify = new PromotionInfoVerify();
			promotionInfoVerify.verifyPromotionPolicyInDB(productPromotionInfoDto.getPromotionPolicyDto(),false);
			verifyProductPromotionInfoDto(productPromotionInfoDto.getProductDtos(),pdtos);
			Logger.verifyEquals(BigDecimal.valueOf(1).setScale(2), productPromotionInfoDto.getPromotionAmount().setScale(2), "验证优惠金额");
			
			//验证 ProductInfos 中freeFreight 新增2020-01-02 summing
			ProductDto productDto=productPromotionInfoDto.getProductDtos().get(0);
			Logger.comment("productDto.getfreeFreight():"+productDto.getfreeFreight());
			if(productDto!=null)
				 Logger.verifyEquals(false,productDto.getfreeFreight(), "验证ProductInfos中的FreeFreight");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}